package dao

import (
	"zk/global"
	"zk/internal/model"
)

func CreateBy(user *model.UserInteraction) bool {
	if err := global.DB.Create(&user).Error; err != nil {
		return false
	}
	return true
}

func GetUserInById(id uint) model.UserInteraction {
	var result model.UserInteraction
	if err := global.DB.Where("id = ?", id).Find(&result); err != nil {
		return model.UserInteraction{}
	}
	return result
}
func GetUpdateUserIn(Id uint, room *model.UserInteraction) model.UserInteraction {
	var result model.UserInteraction
	if err := global.DB.Where("id = ?", Id).Updates(&room); err != nil {
		return model.UserInteraction{}
	}
	return result
}
func GetDeleteUserIn(userIn model.UserInteraction) bool {
	if err := global.DB.Model(model.UserInteraction{}).Delete(&userIn).Error; err != nil {
		return false
	}
	return true
}
